import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../components\/Home.vue'
const routes = [
    {
        path: '/',
        name: 'home',
        component: Home,
        redirect: '/welcome',
        meta: {
            title: '首页'
        },
        children: [
            {
                path: 'welcome',
                name: 'welcome',
                component: () => import('../Views/Welcome.vue')
            },
            {
                path: 'User',
                name: 'User',
                meta: {
                    title: '用户管理页'
                },
                component: () => import('../Views/User.vue')
            },
            {
                path: '/menu',
                name: 'Menu',
                meta: {
                    title: "菜单管理页"
                },
                component: () => import('../Views/Menu.vue')
            },
            {
                path: '/role',
                name: 'Role',
                meta: {
                    title: "角色管理页"
                },
                component: () => import('../Views/Role.vue')
            },
            {
                path: '/dept',
                name: 'Dept',
                meta: {
                    title: "部门管理页"
                },
                component: () => import('../Views/Dept.vue')
            },
        ]
    },
    {
        path: '/Login',
        name: 'Login',
        component: () => import('../Views/Login.vue')
    },


]
// 异步请求你的（admin  alex  jack）地址
// 书局拼接 =》 异步路由拼接
// 总结：后台管理系统的路由
// 是由 固定路由 + 异步路由 拼接成最终的完整路由
const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router